package com.headcaselabs.queue;

import java.util.Collection;
import java.util.concurrent.ConcurrentLinkedQueue;


public class SimpleRoundRobin implements QueueSelectionAlgorithm {

	private ConcurrentLinkedQueue<QueueParameters> queueOfQueues;
	
	public SimpleRoundRobin(Collection<QueueParameters> queues) {
		queueOfQueues = new ConcurrentLinkedQueue<QueueParameters>(queues);
	}
	
	public int getQueueCount() {
		return queueOfQueues.size();
	}

	public QueueParameters nextQueue() {
		QueueParameters qp = queueOfQueues.poll();
		qp.addExTime();
		queueOfQueues.add(qp);
		return qp;
	}

	public void updateQueueParameters(String queue, long actualTime) {
	/*	queueOfQueues.remove(qp);
		qp.adjustCpuTime(actualTime);
		queueOfQueues.add(qp);*/
	}

}
